﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmmMailingReport
{
    public partial class Default : System.Web.UI.Page
    {
        private int? moid
        {
            get
            {
                if (Request.QueryString["moid"] != null)
                    return Convert.ToInt32(Request.QueryString["moid"]);
                else
                    return null;
            }
        }

        private int? subject
        {
            get
            {
                if (Request.QueryString["subject"] != null)
                    return Convert.ToInt32(Request.QueryString["subject"]);
                else
                    return null;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (moid.HasValue)
                GridView1.Visible = false;
            if (subject.HasValue)
                GridView2.Visible = false;
        }

        protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            if (subject.HasValue)
                e.Command.Parameters["@subject"].Value = subject;
        }

        protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            if (moid.HasValue)
                e.Command.Parameters["@moid"].Value = moid;
        }
    }
}